<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>主页</title>
<link rel="stylesheet" href="/static/css/normalize.css">
<link rel="stylesheet" href="/static/css/bootstrap.min.css">

</head>
<body>

	
	
	<div>
	<h3>测试点对点消息队列</h3>
		<form action="" id="myform">
				姓名：<input type="text" name="username"><br>
				密码：<input type="password" name="password"><br>
				说明：<input type="text" name="content"><br>
		<button type="button" id="submitbtn">提交</button>
		<button type="reset">重置</button>
		</form>
	</div>
	
	<div>
	<h3>测试发布/订阅消息队列</h3>
		<form action="" id="topicform">
				消息：<input type="text" name="message" id="message"><br>
		<button type="button" id="topicbtn">提交</button>
		<button type="reset">重置</button>
		</form>
	</div>
	
	<script type="text/javascript" src="/static/js/jquery.js"></script>	
	<script type="text/javascript" src="/static/js/alert.js"></script>
	<script type="text/javascript" src="/static/js/laytpl.js"></script>
	<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function(){
			
			
			$('#submitbtn').on('click',function(){
				$.post('/main/addQueue',$('#myform').serialize(),function(json){
					$.alert(json.message)
				})
			})
			$('#topicbtn').on('click',function(){
				var msg  = $('#message').val();
				for (var i = 0; i < 50; i++) {
					$.post('/main/addTopic',{message:msg+'_A_'+i},function(json){
// 						$.alert(json.message)
					})
					$.post('/main/addTopic',{message:msg+'_B_'+i},function(json){
// 						$.alert(json.message)
					})
					$.post('/main/addTopic',{message:msg+'_C_'+i},function(json){
// 						$.alert(json.message)
					})
					$.post('/main/addTopic',{message:msg+'_D_'+i},function(json){
// 						$.alert(json.message)
					})
					$.post('/main/addTopic',{message:msg+'_E_'+i},function(json){
// 						$.alert(json.message)
					})
					$.post('/main/addTopic',{message:msg+'_E_'+i},function(json){
// 						$.alert(json.message)
					})
					$.post('/main/addTopic',{message:msg+'_F_'+i},function(json){
// 						$.alert(json.message)
					})
					$.post('/main/addTopic',{message:msg+'_G_'+i},function(json){
// 						$.alert(json.message)
					})
				}
				
			})
			
		})
	</script>
	
</body>
</html>